package com.ai.flight.ai.tools;

import java.util.function.Function;

import com.ai.flight.business.record.FlightBooking;
import com.ai.flight.business.service.FlightService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Description;
import org.springframework.core.NestedExceptionUtils;

/**
 * @Author: suren@517na.com
 * @CreateTime: 2025-06-02
 * @Description: AI调用的方法
 *
 * 注意：1.0.0-M6已经弃用这种方法
 */

@Configuration
@Deprecated
public class BookingTools {

    private static final Logger logger = LoggerFactory.getLogger(BookingTools.class);

    @Autowired
    private FlightService flightService;


//    @Bean
//    @Description("获取机票预定详情信息")
//    public Function<FlightBooking.BookingDetailsRequest, FlightBooking.BookingDetails> getBookingDetails() {
//        return request -> {
//            try {
//                return flightService.getBookingDetails(request.bookingNumber(), request.name());
//            } catch (Exception e) {
//                logger.warn("Booking details: {}", NestedExceptionUtils.getMostSpecificCause(e).getMessage());
//                return new FlightBooking.BookingDetails(request.bookingNumber(), request.name(), null, null, null, null, null);
//            }
//        };
//    }

//    @Bean
//    @Description("修改机票预定日期")
//    public Function<FlightBooking.ChangeBookingDatesRequest, String> changeBooking() {
//        return request -> {
//            flightService.changeBooking(request.bookingNumber(), request.name(), request.date(), request.from(),
//                    request.to());
//            return "";
//        };
//    }

//    @Bean
//    @Description("取消机票预定")
//    public Function<FlightBooking.CancelBookingRequest, String> cancelBooking() {
//        return request -> {
//            flightService.cancelBooking(request.bookingNumber(), request.name());
//            return "";
//        };
//    }
}
